export default {
  namespace: 'products',

  state: {
    products: [
      { name: 'dva', id: 1 },
      { name: 'antd', id: 2 }
    ]
  }, // 初始化状态

  reducers: { // 同步操作
    delete(state, { payload: id }) {
      const newProducts = state.products.filter(item => item.id !== id)
      return {
        ...state,
        products: newProducts
      }
    }
  },

  effects: {} // 异步操作
}
